<template>
  <el-dialog :visible.sync="visible" width="75vw" destroy-on-close :close-on-click-modal="false" title="工单明细" @open="handleOpen" @closed="$emit('close')">
    <table-box ref="tableBox" no-request :table-config="tableConfig" :other-filters="otherFilters"></table-box>
  </el-dialog>
</template>
<script>
import { filtersRaw } from '@/utils'
export default {
  name: 'ClientOrderHandleDetail',
  props: {
    row: {
      type: Object,
      default: () => ({})
    },
    queryList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      visible: false,
      tableConfig: {
        interfacePath: '/call-center/api/v2/workOrder/report/deal/info',
        pageFlag: true,
        hideFuncBar: true,
        setting: [
          {
            prop: 'officeName',
            label: '办事处',
            minWidth: 120
          },
          {
            prop: 'disName',
            label: '经销商',
            minWidth: 140
          },
          {
            prop: 'workOrderCode',
            label: '工单编号',
            minWidth: 160
          },
          {
            prop: 'buyChannel',
            label: '购买渠道',
            propEnum: {
              appCode: 'call-center',
              domainCode: 'marketing',
              dictTypeCode: 'PURCHASE_CHANNEL'
            },
            minWidth: 100
          },
          {
            prop: 'businessType1Name',
            label: '一级业务类型',
            minWidth: 130
          },
          {
            prop: 'businessType2Name',
            label: '二级业务类型',
            minWidth: 130
          },
          {
            prop: 'dispatchTime',
            label: '派单时间',
            minWidth: 140
          },
          {
            prop: 'processingDeadlineFirst',
            label: '第一次处理截止时间',
            minWidth: 160
          },
          {
            prop: 'acceptTime',
            label: '接收时间',
            minWidth: 140
          },
          {
            prop: 'applyTime',
            label: '回复时间',
            minWidth: 140
          },
          {
            prop: 'workOrderState',
            label: '工单状态',
            minWidth: 100,
            propEnum: {
              appCode: 'call-center',
              domainCode: 'marketing',
              dictTypeCode: 'WORK_ORDER_STATUS'
            }
          }
        ]
      }
    }
  },
  computed: {
    otherFilters() {
      return [...this.queryList, filtersRaw('statisticalObjectCode', this.row.statisticalObjectCode, '=')]
    }
  },
  methods: {
    showDetail() {
      this.visible = true
    },
    handleOpen() {
      this.$nextTick(() => {
        this.$refs.tableBox.initTableData()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.client-order-handle-detail{
  display: inline-block;
}
</style>
